package com.tm.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.tm.enums.ResultEnum;
import com.tm.pojo.dto.LoginDto;
import com.tm.result.Result;
import com.tm.service.UserService;
import com.tm.utils.SendSmsUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @author xiaobai
 * @create 2022-12-17 21:32
 */
@RestController
@RequestMapping("api/user")
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private RedisTemplate redisTemplate;
    //用户登录验证
    @PostMapping("userLogin")
    public Result userLogin(@RequestBody LoginDto loginDto){


        return userService.userLogin(loginDto);
    }

    //发送验证码

    @PostMapping("sendSms")
    public Result  SendSms(String phoneNumber){

        return userService.SendSms(phoneNumber);
    }
}
